<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>post message</title>
</head>
<body>
 <iframe src="postmessageiframe.html" id="test" style="height:60px"></iframe>
  <input type="text" id="messagetbc" value="Your message"/>
  <button onclick="post()">send</button>

<script>
    function post() {
        document.getElementById("test").contentWindow.postMessage(
          {test:1}
          , "*"
        );
    }
</script>

</body>
</html>